package com.wf.course.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.utils.page.PageBean;
import com.wf.course.service.ISysMenuService;
import com.wf.course.dao.ISysMenuMapper;
import com.wf.course.model.user.SysMenu;

@Service
@Transactional(rollbackFor=Exception.class)
public class ISysMenuServiceImpl implements ISysMenuService{
	
	@Autowired
	private ISysMenuMapper mapper;

	@Override
	public void indexInfo(PageBean<SysMenu> pageBean) {
		// TODO Auto-generated method stub
		pageBean.setResults(this.mapper.queryList(pageBean));
		pageBean.setTotalCount(this.mapper.getTotalCount(pageBean));
		
	}

	@Override
	public void saveOrUpdateSysMenu(SysMenu sysMenu) {
		// TODO Auto-generated method stub
		//新增
		if (sysMenu.getMenuId() == null) {
			this.mapper.saveSysMenu(sysMenu);
		} else {//修改
			this.mapper.updateSysMenu(sysMenu);
	}
 }

	@Override
	public SysMenu querySysMenuById(Integer menuId) {
		// TODO Auto-generated method stub
		return mapper.querySysMenuById(menuId);
	}

	@Override
	public void deleteById(Integer id) {
		// TODO Auto-generated method stub
		this.mapper.deleteById(id);
		 
	}
	 @Override
	 public List<SysMenu> querySysMenuList(){
		 List<SysMenu> menulist = mapper.querySysMenuList();
		 return menulist;
	 }
	 
	 @Override
	 public List<SysMenu> queryMenuList(){
		 return mapper.queryMenuList();
	 }
	 
}
